package com.carlinfo.common.util;

import java.io.InputStream;
import java.util.Enumeration;
import java.util.ResourceBundle;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class ConstantFinalUtil
{
	public static ResourceBundle bundle = ResourceBundle.getBundle("userscenter");
	public static JSONObject CONFIG_JSON = new JSONObject();
	public static JSONObject INFO_JSON = new JSONObject();
	static
	{
		IOUtil ioUtil = new IOUtil();
		InputStream is = IOUtil.class.getResourceAsStream("/config.json");
		String fileStr = ioUtil.readFile(is);
		CONFIG_JSON = (JSONObject) JSON.parse(fileStr);
		INFO_JSON = (JSONObject) CONFIG_JSON.get("info");
	}
	public static void bundleTest()
	{
		ResourceBundle bundle = ResourceBundle.getBundle("userscenter");
		System.out.println("取单个"+bundle.getString("jdbc.driver"));
		Enumeration<String> keysEnu = bundle.getKeys();
		while(keysEnu.hasMoreElements())
		{
			String key = keysEnu.nextElement();
			String val = bundle.getString(key);
			System.out.println(key+"循环"+val);
		}
	}
	public static void main(String[] args)
	{
		ConstantFinalUtil.bundleTest();
	}
}
